﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Text;

namespace Function
{
    public class PubConstant
    {  
        /// <summary>
        /// 权限目标数据库
        /// </summary>
        public static DataBaseTarget PermissionTarget = DataBaseTarget.JHManage;

        /// <summary>
        /// 目标数据库
        /// </summary>
        public enum DataBaseTarget
        {
            JHManage, JHStore, JHAgent, JHMember, JHOrders, JHShop, JHTask, JHGeneralize
        }

        /// <summary>
        /// 得到数据库链接字符串
        /// </summary>
        /// <param name="target"></param>
        /// <returns></returns>
        public static string GetConnectString(DataBaseTarget target = DataBaseTarget.JHManage)
        {
            var str = JHManage;
            switch (target)
            {
                case DataBaseTarget.JHManage:
                    str = JHManage;
                    break;
                case DataBaseTarget.JHStore:
                    str = JHStore;
                    break;
                case DataBaseTarget.JHAgent:
                    str = JHAgent;
                    break;
                case DataBaseTarget.JHMember:
                    str = JHMember;
                    break;
                case DataBaseTarget.JHOrders:
                    str = JHOrders;
                    break;
                case DataBaseTarget.JHShop:
                    str = JHShop;
                    break;
                case DataBaseTarget.JHTask:
                    str = JHTask;
                    break;
                case DataBaseTarget.JHGeneralize:
                    str = JHGeneralize;
                    break;
            }
            return str;
        }

        /// <summary>
        /// JHGeneralize库连接字符串
        /// </summary>
        public static string JHGeneralize
        {
            get
            {
                return ConfigurationManager.AppSettings["JHGeneralize"];
            }
        }

        /// <summary>
        /// JHTask库连接字符串
        /// </summary>
        public static string JHTask
        {
            get
            {
                return ConfigurationManager.AppSettings["JHTask"];
            }
        }

        /// <summary>
        /// JHManage库连接字符串
        /// </summary>
        public static string JHManage
        {
            get
            {
                return ConfigurationManager.AppSettings["JHManage"];
            }
        }

        /// <summary>
        /// JHStore链接字符串
        /// </summary>
        public static string JHStore
        {
            get
            {
                return ConfigurationManager.AppSettings["JHStore"];
            }
        }

        /// <summary>
        /// JHAgent链接字符串
        /// </summary>
        public static string JHAgent
        {
            get
            {
                return ConfigurationManager.AppSettings["JHAgent"];
            }
        }

        /// <summary>
        /// JHMember链接字符串
        /// </summary>
        public static string JHMember
        {
            get
            {
                return ConfigurationManager.AppSettings["JHMember"];
            }
        }
        /// <summary>
        /// JHOrders链接字符串
        /// </summary>
        public static string JHOrders
        {
            get
            {
                return ConfigurationManager.AppSettings["JHOrders"];
            }
        }

        /// <summary>
        /// JHStore链接字符串
        /// </summary>
        public static string JHShop
        {
            get
            {
                return ConfigurationManager.AppSettings["JHShop"];
            }
        }
    }
}
